package com.portal.common.thread.example.part1;

/**
 * 方式一：继承Thread类
 */
class MyThread1 extends Thread{
    @Override
    public void run() {
        for (int i = 0; i < 10; i++) {
            System.out.println("新开线程运行  :  " + i);
        }
    }
}
public class Demo1{
    public static void main(String[] args) {
        MyThread1 myThread1 = new MyThread1();
        myThread1.start();
        for (int i = 0; i < 10; i++) {
            System.out.println("主线程运行  :  " + i);
        }
    }
}
